package com.example.onlinemusic.service;



import com.example.onlinemusic.mapper.LoveMusicMapper;
import com.example.onlinemusic.model.Music;
import org.omg.CORBA.PUBLIC_MEMBER;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LoveMusicService {

    @Autowired
    private LoveMusicMapper loveMusicMapper;

    public Music getLoveMusic(Integer user_id, Integer music_id){
        return loveMusicMapper.getLoveMusic(user_id,music_id);
    }

    public boolean CollectionMusic(Integer user_id,Integer music_id){
        return loveMusicMapper.CollectionMusic(user_id,music_id);
    }

    //查询该用户收藏的所有音乐
    public List<Music> findLoveMusicByUserId(Integer userid){

        return loveMusicMapper.findLoveMusicByUserId(userid);
    }

    //查询该用户 指定 musicname 的音乐,支持模糊查询
    public List<Music> findLoveMusicByMusicName(String musicName,Integer userid){

        return loveMusicMapper.findLoveMusicByMusicName(musicName,userid);
    }

    public int deleteLoveMusic(Integer userId,Integer musicId){
        return loveMusicMapper.deleteLoveMusic(userId,musicId);
    }

    public int deleteLoveMusicByMusicId(Integer musicId){

        return loveMusicMapper.deleteLoveMusicByMusicId(musicId);
    }
}
